package com.model;


import java.util.Scanner;

public class Test {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int y=sc.nextInt();
            int m=sc.nextInt();
            int d=sc.nextInt();
            int sum=0;
            //统计前几个月的天数和
            //其实和上面的思想一样
            //但是我还是还是觉得上面方法比较好
            int[] day={0,31,59,90, 120, 151, 181, 212,243, 273, 304, 334, 365};
            if(m>=2){
                sum+=day[m-1];
            }
            sum+=d;
            if(m>2){
                if(y%400==0 || y%4==0&&y%100!=0){
                    sum+=1;
                }
            }
            System.out.println(sum);
        }
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        Movie movie = new Movie();
        String name = sc.next();
        String lei = sc.next();
        String time = sc.next();
        String area = sc.next();
        movie.setName(name);
        movie.setLei(lei);
        movie.setTime(time);
        movie.setArea(area);
        movie.say();

    }
}
